<?php
/**
 * konwertuje string for frendlu url
 *
 * @param string $link // adres url
 * @param string $podmien // znaki na które zastąpią niechciane znaki
 * @param string $uwzglednij // pozostaw znaki
 * @return string
 * przykład
 * {$url|frendlyurl:-:[^0-9A-Za-z\-_\.]}
 */
function smarty_modifier_frendlyurl($link='', $podmien='_',$uwzglednij="[^0-9A-Za-z_]"){
	$znaki = array("ó","ł","ń","ć","ź","ż","ą","ś","ę","Ó","Ł","Ń","Ć","Ź","Ż","Ą","Ś","Ę");
		$znakx = array("o","l","n","c","z","z","a","s","e","O","L","N","C","Z","Z","A","S","E");
		$link = str_ireplace($znaki,$znakx,$link);
		$link = strtr($link,'/ABCDEFGHIJKLMNOPRSTWZXY:','-abcdefghijklmnoprstwzxy-');
		//$link = urlencode($link);
		return strtolower(preg_replace("/{$uwzglednij}/",$podmien,$link));
}
?>